import nodemailer from 'nodemailer';

const transporter = nodemailer.createTransport({
  host: 'smtp.ethereal.email',
  port: 587,
  secure: false,
  auth: {
    user: 'nyasia15@ethereal.email',
    pass: 'YrgWhcE23A4Ef4RJAZ'
  },
});

export const sendVerificationEmail = async (email: string, code: string) => {
  await transporter.sendMail({
    from: '<yywenxin@outlook.com>',
    to: email,
    subject: '邮箱验证码',
    html: `<p>您的注册验证码是: <strong>${code}</strong></p>`,
  });
};

export const sendPasswordResetEmail = async (email: string, code: string) => {
  await transporter.sendMail({
    from: '"Your App" <noreply@example.com>',
    to: email,
    subject: '密码重置',
    html: `<p>您的密码重置验证码是: <strong>${code}</strong></p>`,
  });
};